﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>开通城市</title>
    <link href="~/plugins/layui/css/layui.css" rel="stylesheet" />
</head>
<body style="margin-left:10px;margin-top:10px;">
    <div id="ss" class="layui-form-item">
        <div class="layui-inline">
            <div class="layui-input-inline" style="width: 30px;">
                <i class="layui-icon" style="font-size: 30px; color: #1E9FFF;">&#xe615;</i>
            </div>
            <div class="layui-input-inline" style="width: 150px;">
                <input type="text" placeholder="城市名称" name="city" class="layui-input" value="@ViewBag.city" />
            </div>
            <div class="layui-input-inline" style="width: 150px;">
                <input type="text" placeholder="开始时间" name="stime" lay-verify="date" autocomplete="off" class="layui-input" onclick="layui.laydate({ elem: this, istime: true, festival: true, format: 'YYYY-MM-DD hh:mm:ss' })" value="@ViewBag.stime" />
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline" style="width: 150px;">
                <input type="text" placeholder="结束时间" name="etime" lay-verify="date" autocomplete="off" class="layui-input" onclick="layui.laydate({ elem: this, istime: true, festival: true, format: 'YYYY-MM-DD hh:mm:ss' })" value="@ViewBag.etime" />
            </div>
            <div class="layui-input-inline">
                <a href="javascript: page(-1,-1);" class="layui-btn">给偶搜</a>
            </div>
        </div>
    </div>
    <div class="layui-form">
        <table class="layui-table">
            <thead>
                <tr>
                    <th>省份名称</th>
                    <th>城市名称</th>
                    <th>排序</th>
                    <th>是否显示</th>
                    <th>入库时间</th>
                    <th>管理操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr id="@item.gid">
                        <td>@item.province</td>
                        <td>@item.city</td>
                        <td>@item.sort</td>
                        <td>@(item.show == 1 ? "显示" : "不显示")</td>
                        <td>@item.addtime</td>
                        <td>
                            <div class="layui-btn-group">
                                <button class="layui-btn" onclick="Showiframe('@item.province@item.city','/ljsheng/opencity?gid=@item.gid');">编辑</button>
                                <button class="layui-btn" onclick="Delete('@item.gid');">删除</button>
                            </div>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
    <div id="page">
    </div>共 @ViewBag.count 条
    <script src="~/js/jquery.js"></script>
    <script src="~/plugins/layui/layui.js"></script>
    <script src="~/js/ljsheng.js"></script>
    <script>
        page(@ViewBag.pages,@ViewBag.pageindex);
        //删除数据
        function Delete(gid) {
            layer.confirm('你确定要执行此操作吗？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                $.ajax({
                    url: "/ljsheng/citydelete",
                    data: "gid=" + gid,
                    type: "post",
                    cache: false,
                    timeout: 8000,
                    dataType: "json",
                    ContentType: "application/json; charset=utf-8",
                    error: function () { layer.msg("请求超时"); },
                    beforeSend: function () { },
                    success: function (data) {
                        if (data.result == 200) {
                            $("#" + gid).hide(5);
                            layer.msg(data.data, { icon: 1 });
                        }
                        else {
                            layer.msg(data.data);
                        }
                    },
                });
            });
        }
    </script>
</body>
</html>
